testsuite: Add tests for gtk_list_box_row_get_index
authorKalev Lember <kalevlember@gmail.com>
Thu, 4 Jul 2013 12:15:22 +0000 (14:15 +0200)
committerKalev Lember <kalevlember@gmail.com>
Thu, 4 Jul 2013 13:19:47 +0000 (15:19 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=703618

testsuite/gtk/listbox.c

index 6db127684fec2b9871b8e767cbece2c33ea189dd..4f5e22db1b91fbc0998b66be6fa180d955a72eed 100644 (file)
@@ -106,6 +106,7 @@ test_selection (void)
   gint i;
   gchar *s;
   gint count;
+  gint index;
 
   list = GTK_LIST_BOX (gtk_list_box_new ());
   g_object_ref_sink (list);
@@ -153,6 +154,16 @@ test_selection (void)
   row2 = gtk_list_box_get_selected_row (list);
   g_assert (row2 == NULL);
 
+  row = gtk_list_box_get_row_at_index (list, 20);
+  index = gtk_list_box_row_get_index (row);
+  g_assert_cmpint (index, ==, 20);
+
+  row = GTK_LIST_BOX_ROW (gtk_list_box_row_new ());
+  g_object_ref_sink (row);
+  index = gtk_list_box_row_get_index (row);
+  g_assert_cmpint (index, ==, -1);
+  g_object_unref (row);
+
   g_object_unref (list);
 }